package net.betou.trade.entity.main.base;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import net.betou.trade.entity.main.AgentAndAdmins;
import net.betou.trade.entity.main.AgentAndAdminsExt;
import net.betou.trade.entity.main.Config;
import net.betou.trade.entity.main.Funds;
import net.betou.trade.entity.main.Picture;
import net.betou.trade.entity.main.Role;
import net.betou.trade.entity.main.User;

/**
 * 居间商户表
 * @author 叶装装 
 */
public abstract class BaseAgentAndAdmins implements Serializable{

	public BaseAgentAndAdmins( ) {
		initialize( );
	}

	protected void initialize( ) {
	}

	private Integer id;
	private String intermediaName; // 居间商名称

	private String username; // 用户名
	private String password; // 密码
	private String salt; // 密码混淆
	private String email; // email
	private String mobile; // 手机号码

	private Date createDate;
	private String createIp;
	private Integer loginCount;
	private String loginIp;
	private Date loginDate;

	private Boolean justAdmin; // 只是管理员
	private Boolean disabled; // 是否停用
	private Boolean system;	// 是否是系统管理员

	private String topIntermedia; // 表示是否引用了上级居间
	
	private Integer deep; // 深度
	
	private Boolean agencyOrProxy; // 是机构还是代理
	
	private AgentAndAdmins parent; // 自引用，表示添加居间的adminid
	
	// collection
	private Set< AgentAndAdminsExt > adminExt;
	private Set< Funds > funds;
	private Set< Role > roles; // 角色列表
	private Set< User > users; // 用户列表
	private Set< AgentAndAdmins > childs; // 自引用，自己下面的代理人数, 或者机构人数
	private Set< Picture > pics; // 图片列表
	private Set< Role > myRoles; // 我的角色列表
	
	// 站点配置
	private Set< Config > configs;
	
	private static final long serialVersionUID = 8878785790492789834L;

	private int hashCode = Integer.MIN_VALUE;
	
	public int hashCode () {
		if (Integer.MIN_VALUE == this.hashCode) {
			if (null == this.getId()) return super.hashCode();
			else {
				String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
				this.hashCode = hashStr.hashCode();
			}
		}
		return this.hashCode;
	}
	
	public boolean equals( Object obj ) {
		if( null == obj )
			return false;
		if( !( obj instanceof AgentAndAdmins ) )
			return false;
		else{
			AgentAndAdmins intermedia = ( AgentAndAdmins ) obj;
			if( null == this.getId( ) || null == intermedia.getId( ) )
				return false;
			else
				return( this.getId( ).equals( intermedia.getId( ) ) );
		}
	}

	public Integer getId( ) {
		return id;
	}

	public void setId( Integer id ) {
		this.id = id;
		this.hashCode = Integer.MIN_VALUE;
	}

	public String getUsername( ) {
		return username;
	}

	public void setUsername( String username ) {
		this.username = username;
	}

	public String getPassword( ) {
		return password;
	}

	public void setPassword( String password ) {
		this.password = password;
	}

	public String getSalt( ) {
		return salt;
	}

	public void setSalt( String salt ) {
		this.salt = salt;
	}

	public String getEmail( ) {
		return email;
	}

	public void setEmail( String email ) {
		this.email = email;
	}

	public String getMobile( ) {
		return mobile;
	}

	public void setMobile( String mobile ) {
		this.mobile = mobile;
	}

	public Date getCreateDate( ) {
		return createDate;
	}

	public void setCreateDate( Date createDate ) {
		this.createDate = createDate;
	}

	public String getCreateIp( ) {
		return createIp;
	}

	public void setCreateIp( String createIp ) {
		this.createIp = createIp;
	}

	public Integer getLoginCount( ) {
		return loginCount;
	}

	public void setLoginCount( Integer loginCount ) {
		this.loginCount = loginCount;
	}

	public String getLoginIp( ) {
		return loginIp;
	}

	public void setLoginIp( String loginIp ) {
		this.loginIp = loginIp;
	}

	public Date getLoginDate( ) {
		return loginDate;
	}

	public void setLoginDate( Date loginDate ) {
		this.loginDate = loginDate;
	}

	public Boolean getJustAdmin( ) {
		return justAdmin;
	}

	public void setJustAdmin( Boolean justAdmin ) {
		this.justAdmin = justAdmin;
	}

	public Boolean getDisabled( ) {
		return disabled;
	}

	public void setDisabled( Boolean disabled ) {
		this.disabled = disabled;
	}
	
	public AgentAndAdmins getParent( ) {
		return parent;
	}

	public void setParent( AgentAndAdmins parent ) {
		this.parent = parent;
	}

	public Integer getDeep( ) {
		return deep;
	}

	public void setDeep( Integer deep ) {
		this.deep = deep;
	}

	public String getIntermediaName( ) {
		return intermediaName;
	}

	public void setIntermediaName( String intermediaName ) {
		this.intermediaName = intermediaName;
	}

	public String getTopIntermedia( ) {
		return topIntermedia;
	}

	public void setTopIntermedia( String topIntermedia ) {
		this.topIntermedia = topIntermedia;
	}

	public Boolean getSystem( ) {
		return system;
	}

	public void setSystem( Boolean system ) {
		this.system = system;
	}

	public Set< AgentAndAdminsExt > getAdminExt( ) {
		return adminExt;
	}

	public void setAdminExt( Set< AgentAndAdminsExt > adminExt ) {
		this.adminExt = adminExt;
	}

	public Set< Role > getRoles( ) {
		return roles;
	}

	public void setRoles( Set< Role > roles ) {
		this.roles = roles;
	}

	public Set< User > getUsers( ) {
		return users;
	}

	public void setUsers( Set< User > users ) {
		this.users = users;
	}

	public Set< AgentAndAdmins > getChilds( ) {
		return childs;
	}

	public void setChilds( Set< AgentAndAdmins > childs ) {
		this.childs = childs;
	}

	public Set< Picture > getPics( ) {
		return pics;
	}

	public void setPics( Set< Picture > pics ) {
		this.pics = pics;
	}

	public Boolean getAgencyOrProxy( ) {
		return agencyOrProxy;
	}

	public void setAgencyOrProxy( Boolean agencyOrProxy ) {
		this.agencyOrProxy = agencyOrProxy;
	}

	public Set< Config > getConfigs( ) {
		return configs;
	}

	public void setConfigs( Set< Config > configs ) {
		this.configs = configs;
	}

	public Set< Role > getMyRoles( ) {
		return myRoles;
	}

	public void setMyRoles( Set< Role > myRoles ) {
		this.myRoles = myRoles;
	}

	public Set< Funds > getFunds( ) {
		return funds;
	}

	public void setFunds( Set< Funds > funds ) {
		this.funds = funds;
	}
}
